import fetch from 'utils/fetch';

//根据名称模糊查询学校名称
export function listSchoolByName(schoolName) {
    const data = {
        schoolName
    };
    return fetch({
        url: '/school/listSchoolByName',
        // url: 'http://192.168.0.104:8080/edu-education-web/edu/school/listSchoolByName',
        method: 'post',
        data
    });
}

//获取学校科目
export function listSubjectBySchoolId(schoolId) {
    const data = {
        schoolId
    };
    return fetch({
        // http://192.168.0.183:8080/exue-education-web/edu/teacher/listSubjectByName
        url: '/school/listSubjectBySchoolId',
        // url: '/edu/teacher/listSubjectByName',
        method: 'post',
        data
    });
}

//根据学校id查班级
export function queryListClassById(schoolId) {
    const data = {
        schoolId
    };
    return fetch({
        url: '/eduClass/listClassBySchoolId',
        method: 'post',
        data
    });
}

// 查询考试类型
export function listExamType() {
    const data = {

    };
    return fetch({
        url: '/score/listExamType',
        method: 'post',
        data
    });
}

//导出Excel表格
export function queryExportScoreXLS(classId, subjectIds, schoolId, examTypeId, token) {
    const params = {
        classId,
        subjectIds,
        schoolId,
        examTypeId,
        token
    };
    return fetch({
        url: '/score/exportTemplate',
        method: 'get',
        params
    });
}

//导入Excel表格
export function querySaveExamAndScores(schoolId, classId, examTypeId, startTime, url, fileName, subjectIds) {
    const data = {
        schoolId,
        classId,
        examTypeId,
        startTime,
        url,
        fileName,
        subjectIds
    };
    return fetch({
        url: '/score/saveExamAndScores',
        method: 'post',
        data
    });
}

//获取成绩列表
export function queryListScoreByPage(curPage, pageSize, fSchoolId, fClassId, sExamType, startTime, endTime) {
    const data = {
        curPage,
        pageSize,
        fSchoolId,
        fClassId,
        sExamType,
        startTime,
        endTime
    };
    return fetch({
        url: '/score/pageExams/' + curPage + '/' + pageSize,
        method: 'post',
        data
    });
}

//获取学生成绩详情列表
export function queryListScoreStudentByPage(curPage, pageSize, pId, fSchoolId) {
    const data = {
        curPage,
        pageSize,
        pId,
        fSchoolId
    };
    return fetch({
        url: '/score/pageScores/' + curPage + '/' + pageSize,
        method: 'post',
        data
    });
}

//删除
// http://192.168.0.174:8082/exue-education-web/edu/score/deleteExamAndScores
export function deleteExamAndScores(pId) {
    const data = {
        pId
    };
    return fetch({
        url: '/score/deleteExamAndScores',
        method: 'post',
        data
    });
}
